package com.xy.controller;

import com.xy.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Api
@RestController
public class HelloController {

    @GetMapping("/hello")
    public String hello(){
        return "Hello Swagger!!!";
    }

    //只要我们的接口中，返回值中存在实体类，他就会扫描到Swagger中
    @GetMapping("/user")
    public User user(){
        return new User();
    }

    //Swagger测试   @ApiOperation方法的注释，@ApiParam参数上的注释
    @ApiOperation("Hello测试类")
    @PostMapping("/test1")
    public String test1(@ApiParam("用户名") String username){
        return "hello+"+username;
    }
}
